import 'package:flutter/material.dart';

// Refer to: https://github.com/flutter/samples/blob/main/compass_app/app/lib/ui/core/themes/dimens.dart
abstract class Dimens {
  const Dimens();

  static const smallPaddinghorizontal = 8.0;
  static const paddingHorizontal = 20.0;
  static const paddingVertical = 24.0;
  static var buttonRadius = BorderRadius.circular(4.0);

  double get paddingScreenHorizontal;
  double get paddingScreenVertical;

  static const Dimens tablet = _DimensTablet();
  static const Dimens mobile = _DimensMobile();

  factory Dimens.of(BuildContext context) => switch (MediaQuery.sizeOf(context).width) {
        > 600 => tablet,
        _ => mobile,
      };
}

final class _DimensMobile extends Dimens {
  const _DimensMobile();
  @override
  double get paddingScreenHorizontal => Dimens.paddingHorizontal;

  @override
  double get paddingScreenVertical => Dimens.paddingVertical;
}

final class _DimensTablet extends Dimens {
  const _DimensTablet();

  @override
  double get paddingScreenHorizontal => 100.0;

  @override
  double get paddingScreenVertical => 64.0;
}
